<!-- 主播列表 -->
<template>
  <div class="goods-item" @click="goAnchor(props.goodsItemDetail)">
    <van-image fit="cover" :src="props.goodsItemDetail ? props.goodsItemDetail.avatar : '' " />
    <div class="goods-item-content">
      <h4>{{props.goodsItemDetail.nickname}}</h4>
      <p>更新时间：{{props.goodsItemDetail.updateTime ? props.goodsItemDetail.updateTime.split(" ")[0] : '待更新'}}</p>
    </div>
  </div>
</template>
<script setup>
import { ref } from "vue";
import { useRouter } from "vue-router";
const router = useRouter()

const props = defineProps({
  goodsItemDetail: {
    type: Object,
    default: () => { },
  },
  types:{
    type:Number,
    default:0,
  }
});

const goAnchor = (item) => {
  if(props.types == 0){
    router.push({
    name:'anchor',
    query:{
      id:item.id,
      name:item.nickname,
      url:item.avatar
    }
  })
  }else{
    router.push({
    name:'goodsOrder',
    query:{
      id:item.id
    }
  })
  }

}

</script>


<style lang="scss" scoped>
.van-image {
  display: block;
  width: 100%;
  min-height: 100px;
  height: 200px;
}

.goods-item {
  background: #fff;
  border-radius: .75em;
  border-radius: 0.5em;
  overflow: hidden;
  margin-bottom: .5em;

  .goods-item-content {
    padding: .5em;
  }

  h4 {
    font-weight: normal;
    font-size: 1em;
    margin-bottom: .25em;
    color:#333;
  }

  p {
    color: #f00;
    font-size: .75em;
  }
}
</style>
